package array;

import java.util.List;

public class L120 {
    public int minimumTotal(List<List<Integer>> triangle) {
        for (int row = triangle.size()-2; row>=0; row--) {
            for (int col = 0; col<triangle.get(row).size(); col++) {
                //遍历这一行的所有的元素
                int minsum=Math.min(triangle.get(row +1).get(col) , triangle.get(row+1).get(col +1));
                triangle.get(row).set(col, triangle.get(row).get(col) + minsum);


            }
        }
        return triangle.get(0).get(0);

    }
}

